package com.system.user.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.system.user.dao.BindDao;
import com.system.user.entity.BindEntity;
import com.system.user.service.BindService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("bindService")
public class BindServiceImpl implements BindService {

    @Autowired
    private BindDao bindDao;

    @Override
    public boolean add(int uId, String bNumber) {
        List<BindEntity> list = bindDao.queryByUidAndBNumber(uId, bNumber);
        if (list.size() <= 0 && bindDao.insertBind(uId, bNumber) > 0) {
            return true;
        }
        return false;
    }

    @Override
    public boolean deleteByUidAndBNumber(Integer uId, String bNumber) {
        if (bindDao.deleteByUidAndBNumber(uId, bNumber) > 0) {
            return true;
        }
        return false;
    }
}
